<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Spring boot Mybatis | sougoulog</title>
<!-- Tell the browser to be responsive to screen width -->
<meta
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
	name="viewport">
<!-- Bootstrap 3.3.7 -->
<link rel="stylesheet"
	href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet"
	href="bower_components/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet"
	href="bower_components/Ionicons/css/ionicons.min.css">
<!-- jvectormap -->
<link rel="stylesheet"
	href="bower_components/jvectormap/jquery-jvectormap.css">
<!-- bootgrid -->
<link rel="stylesheet" href="dist/css/jquery.bootgrid.min.css" />
<!-- bootstrap datepicker -->
<link rel="stylesheet"
	href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->
<style type="text/css">
em {
	color: red
}
pre {outline: 1px solid #ccc; }
 .string { color: green; }
 .number { color: darkorange; }
 .boolean { color: blue; }
 .null { color: magenta; }
 .key { color: red; }
</style>
<!-- Google Font -->
<link rel="stylesheet" href="dist/css/fonts.googleapis.com.css">
</head>
<body class="hold-transition skin-blue sidebar-mini fixed">
	<div class="wrapper">

		<header class="main-header">

			<!-- Logo -->
			<a href="index2.html" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels -->
				<span class="logo-mini"><b>A</b>LT</span> <!-- logo for regular state and mobile devices -->
				<span class="logo-lg"><b>Spring </b>Elastic Search</span>
			</a>

			<!-- Header Navbar: style can be found in header.less -->
			<nav class="navbar navbar-static-top">
				<!-- Sidebar toggle button-->
				<a href="#" class="sidebar-toggle" data-toggle="push-menu"
					role="button"> <span class="sr-only">Toggle navigation</span>
				</a>
				<!-- Navbar Right Menu -->
				<div class="navbar-custom-menu">
					<ul class="nav navbar-nav">


						<!-- User Account: style can be found in dropdown.less -->
						<li class="dropdown user user-menu"><a href="#"
							class="dropdown-toggle" data-toggle="dropdown"> <img
								src="dist/img/user2-160x160.jpg" class="user-image"
								alt="User Image"> <span class="hidden-xs username">
							</span>
						</a>
							<ul class="dropdown-menu">
								<!-- User image -->
								<li class="user-header"><img
									src="dist/img/user2-160x160.jpg" class="img-circle"
									alt="User Image">

									<p>
										Alexander Pierce - Web Developer <small>Member since
											Nov. 2012</small>
									</p></li></li>
						<!-- Menu Footer-->
						<li class="user-footer">

							<div class="pull-right">
								<a href="logout" class="btn btn-default btn-flat">Sign out</a>
							</div>
						</li>
					</ul>
					</li>
					<!-- Control Sidebar Toggle Button -->
					<li><a href="#" data-toggle="control-sidebar"><i
							class="fa fa-gears"></i></a></li>
					</ul>
				</div>

			</nav>
		</header>
		<!-- Left side column. contains the logo and sidebar -->
		<aside class="main-sidebar">
			<!-- sidebar: style can be found in sidebar.less -->
			<section class="sidebar">
				<!-- Sidebar user panel -->
				<div class="user-panel">
					<div class="pull-left image">
						<img src="dist/img/user2-160x160.jpg" class="img-circle"
							alt="User Image">
					</div>
					<div class="pull-left info">
						<p class="username">Alexander Pierce</p>
						<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
					</div>
				</div>

				<!-- sidebar menu: : style can be found in sidebar.less -->
				<ul class="sidebar-menu" data-widget="tree">
					<li class="header">MAIN NAVIGATION</li>
					<li class="active"><a href="index"> <i class="fa fa-calendar"></i> <span>索引构建</span>
					</a></li>
					<li class="treeview"><a href="#"> <i
							class="fa fa-search-plus"></i> <span>高级搜索</span> <span
							class="pull-right-container"> <i
								class="fa fa-angle-left pull-right"></i>
						</span>
					</a>
						<ul class="treeview-menu">
							<li><a href="sougoulog"><i
									class="fa fa-search"></i> 多字段搜索</a></li>
							<li><a href="distance"><i class="fa fa-life-bouy"></i> 经纬度搜索</a></li>
						</ul></li>
					<li><a href="analysis"> <i class="fa fa-edit"></i> <span>聚集统计</span>
					</a></li>
					<li class=" treeview"><a href="#"> <i
							class="fa fa-group"></i> <span>父子关系</span> <span
							class="pull-right-container"> <i
								class="fa fa-angle-left pull-right"></i>
						</span>
					</a>
						<ul class="treeview-menu">
							<li><a href="city"><i class="fa fa-search"></i> 嵌套对象</a></li>
							<li class="treeview">
          <a href="#">
            <i class="fa fa-share"></i> <span>JOIN关联</span>
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>
          </a>
          <ul class="treeview-menu">
            <li>
              <a href="hasparent"><i class="fa fa-circle-o"></i>以父搜子
              </a>
            </li>
            <li>
              <a href="haschild"><i class="fa fa-circle-o"></i>以子搜父
              </a>
            </li>
          </ul>
        </li>
				</ul>
			</section>
			<!-- /.sidebar -->
		</aside>

		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>
					构建索引 <small>批量导入数据</small>
				</h1>
				<ol class="breadcrumb">
					<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
					<li>高级搜索</li>
					<li class="active">多字段搜索</li>
				</ol>
			</section>

			<!-- Main content -->
			<section class="content">
				<!-- Info boxes -->
				<div class="row">
					<!-- Main row -->
					<div class="row">
						<!-- Left col -->
						<div class="col-md-12">
							<!-- TABLE: LATEST ORDERS -->
							<div class="box box-info">
								<div class="box-header with-border">
									<h3 class="box-title">建立索引并导入数据</h3>
									<div class="box-tools pull-right">
										<button type="button" class="btn btn-box-tool"
											data-widget="collapse">
											<i class="fa fa-minus"></i>
										</button>
										<button type="button" class="btn btn-box-tool"
											data-widget="remove">
											<i class="fa fa-times"></i>
										</button>
									</div>
								</div>
								<!-- /.box-header -->
								<div class="box-body">
									<button type="button" id="mapping" class="btn btn-primary col-md-3">构建搜狗日志索引结构</button>
									<button type="button" id="import" class="btn btn-primary col-md-3">批量导入搜狗日志记录</button>
									<button type="button" id="distancemapping" class="btn btn-warning col-md-3">构建经纬度索引结构</button>
									<button type="button" id="importdistance" class="btn btn-warning col-md-3">批量导入经纬度记录</button>
									<button type="button" id="nestedmapping" class="btn btn-info col-md-3">构建嵌套对象索引结构</button>
									<button type="button" id="nestedimport" class="btn btn-info col-md-3">批量导入嵌套对象记录</button>
									<button type="button" id="joinmapping" class="btn btn-danger col-md-3">构建join关联索引结构</button>
									<button type="button" id="joinimport" class="btn btn-danger col-md-3">批量导入join关联记录</button>
								</div>
							</div>
						</div>
						<!-- /.box -->
					</div>
					<!-- /.col -->


				</div>
				<!-- /.row -->
			</section>
			<!-- /.content -->
		</div>
		<!-- /.content-wrapper -->

		<footer class="main-footer">
			<div class="pull-right hidden-xs">
				<b>Version</b> 2.4.18
			</div>
			<strong>Copyright &copy; 2014-2019 <a
				href="https://adminlte.io">AdminLTE</a>.
			</strong> All rights reserved.
		</footer>

		<!-- Control Sidebar -->
		<aside class="control-sidebar control-sidebar-dark">
			<!-- Create the tabs -->
			<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
				<li><a href="#control-sidebar-home-tab" data-toggle="tab"><i
						class="fa fa-home"></i></a></li>
				<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i
						class="fa fa-gears"></i></a></li>
			</ul>
			<!-- Tab panes -->
			<div class="tab-content">
				<!-- Home tab content -->
				<div class="tab-pane" id="control-sidebar-home-tab">
					<h3 class="control-sidebar-heading">Recent Activity</h3>
					<ul class="control-sidebar-menu">
						<li><a href="javascript:void(0)"> <i
								class="menu-icon fa fa-birthday-cake bg-red"></i>

								<div class="menu-info">
									<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>

									<p>Will be 23 on April 24th</p>
								</div>
						</a></li>
						<li><a href="javascript:void(0)"> <i
								class="menu-icon fa fa-user bg-yellow"></i>

								<div class="menu-info">
									<h4 class="control-sidebar-subheading">Frodo Updated His
										Profile</h4>

									<p>New phone +1(800)555-1234</p>
								</div>
						</a></li>
						<li><a href="javascript:void(0)"> <i
								class="menu-icon fa fa-envelope-o bg-light-blue"></i>

								<div class="menu-info">
									<h4 class="control-sidebar-subheading">Nora Joined Mailing
										List</h4>

									<p>nora@example.com</p>
								</div>
						</a></li>
						<li><a href="javascript:void(0)"> <i
								class="menu-icon fa fa-file-code-o bg-green"></i>

								<div class="menu-info">
									<h4 class="control-sidebar-subheading">Cron Job 254
										Executed</h4>

									<p>Execution time 5 seconds</p>
								</div>
						</a></li>
					</ul>
					<!-- /.control-sidebar-menu -->

					<h3 class="control-sidebar-heading">Tasks Progress</h3>
					<ul class="control-sidebar-menu">
						<li><a href="javascript:void(0)">
								<h4 class="control-sidebar-subheading">
									Custom Template Design <span
										class="label label-danger pull-right">70%</span>
								</h4>

								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-danger"
										style="width: 70%"></div>
								</div>
						</a></li>
						<li><a href="javascript:void(0)">
								<h4 class="control-sidebar-subheading">
									Update Resume <span class="label label-success pull-right">95%</span>
								</h4>

								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-success"
										style="width: 95%"></div>
								</div>
						</a></li>
						<li><a href="javascript:void(0)">
								<h4 class="control-sidebar-subheading">
									Laravel Integration <span
										class="label label-warning pull-right">50%</span>
								</h4>

								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-warning"
										style="width: 50%"></div>
								</div>
						</a></li>
						<li><a href="javascript:void(0)">
								<h4 class="control-sidebar-subheading">
									Back End Framework <span class="label label-primary pull-right">68%</span>
								</h4>

								<div class="progress progress-xxs">
									<div class="progress-bar progress-bar-primary"
										style="width: 68%"></div>
								</div>
						</a></li>
					</ul>
					<!-- /.control-sidebar-menu -->

				</div>
				<!-- /.tab-pane -->

				<!-- Settings tab content -->
				<div class="tab-pane" id="control-sidebar-settings-tab">
					<form method="post">
						<h3 class="control-sidebar-heading">General Settings</h3>

						<div class="form-group">
							<label class="control-sidebar-subheading"> Report panel
								usage <input type="checkbox" class="pull-right" checked>
							</label>

							<p>Some information about this general settings option</p>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Allow mail
								redirect <input type="checkbox" class="pull-right" checked>
							</label>

							<p>Other sets of options are available</p>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Expose author
								name in posts <input type="checkbox" class="pull-right" checked>
							</label>

							<p>Allow the user to show his name in blog posts</p>
						</div>
						<!-- /.form-group -->

						<h3 class="control-sidebar-heading">Chat Settings</h3>

						<div class="form-group">
							<label class="control-sidebar-subheading"> Show me as
								online <input type="checkbox" class="pull-right" checked>
							</label>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Turn off
								notifications <input type="checkbox" class="pull-right">
							</label>
						</div>
						<!-- /.form-group -->

						<div class="form-group">
							<label class="control-sidebar-subheading"> Delete chat
								history <a href="javascript:void(0)" class="text-red pull-right"><i
									class="fa fa-trash-o"></i></a>
							</label>
						</div>
						<!-- /.form-group -->
					</form>
				</div>
				<!-- /.tab-pane -->
			</div>
		</aside>
		<!-- /.control-sidebar -->
		<!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
		<div class="control-sidebar-bg"></div>

	</div>
	<!-- ./wrapper -->




	<!-- jQuery 3 -->
	<script src="bower_components/jquery/dist/jquery.min.js"></script>
	<!-- Bootstrap 3.3.7 -->
	<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="bower_components/fastclick/lib/fastclick.js"></script>
	<!-- AdminLTE App -->
	<script src="dist/js/adminlte.min.js"></script>
	<!-- Sparkline -->
	<script
		src="bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
	<!-- jvectormap  -->
	<script src="plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
	<script src="plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
	<!-- bootstrap datepicker -->
	<script
		src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
	<!-- SlimScroll -->
	<script
		src="bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
	<!-- ChartJS -->
	<script src="bower_components/chart.js/Chart.js"></script>
	<!-- bootgrid -->
	<script src="dist/js/jquery.bootgrid.min.js"></script>
	<!-- AdminLTE for demo purposes -->
	<script src="dist/js/demo.js"></script>
	<script type="text/javascript">
  $(document).ready(function(){
  	$("#insertactor").click(function(){
  		 $.get("/sougoulognumber",function(str){
	        	var total = str.data;
	        	total++;
	        	var json={"key":total,"id":total,"visittime":$("#visittime2").val(),"userid":$("#userid2").val(),"keywords":$("#keywords2").val()
  				  ,"rank":$("#rank2").val(),"clicknum":$("#clicknum2").val(),"url":$("#url2").val()};
				   $.ajax({  
		            url : "/indexSougoulog",  
		            type : "POST",  
		            data : JSON.stringify(json), //转JSON字符串  
		            dataType: 'json',  
		            contentType:'application/json;charset=UTF-8', //contentType很重要     
		            success : function(result) {  
		                //alert("添加成功"+JSON.stringify(result));  
		                $("#modal-info").modal("hide");
		                $("#modal-success").modal();
		            }  
			     });
  	});
  });
  
  $("#updateactor").click(function(){
  		var json={"id":$("#id").val(),"visittime":$("#visittime").val(),"userid":$("#userid").val(),"keywords":$("#keywords").val()
  				  ,"rank":$("#rank").val(),"clicknum":$("#clicknum").val(),"url":$("#url").val()};
		   $.ajax({  
            url : "/indexDoc/sougoulog/_doc",  
            type : "POST",  
            data : JSON.stringify(json), //转JSON字符串  
            dataType: 'json',  
            contentType:'application/json;charset=UTF-8', //contentType很重要     
            success : function(result) {  
                $(".actormodal").modal("hide");
                $("#grid-data").bootgrid("reload");
                $("#modal-success").modal();
            }  
  	
  	});
  }); 
  
   
   
 var grid =$("#grid-data").bootgrid({
    ajax:true,
    url:"/sougoulog",
    navigation:3,
    ajaxSettings: {
        method: "POST",
        cache: false
    },	
        formatters: {
        "keywords": function(column, row){
        	var search = "highlight";
	        var highlightObj = row[search];
	        var currentKey = column.id;
	        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
	            return highlightObj[currentKey];
	        } else {
	            return row[currentKey];
	        }
        },
        "url": function(column, row){
        	var search = "highlight";
	        var highlightObj = row[search];
	        var currentKey = column.id;
	        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
	            return highlightObj[currentKey];
	        } else {
	            return row[currentKey];
	        }
        },
        "userid": function(column, row){
        	var search = "highlight";
	        var highlightObj = row[search];
	        var currentKey = column.id;
	        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
	            return highlightObj[currentKey];
	        } else {
	            return row[currentKey];
	        }
        },
        "commands": function(column, row)
        {
            return "<button type=\"button\" class=\"btn btn-xs btn-default command-edit\" data-row-id=\"" + row.id + "\">编辑<span class=\"glyphicon glyphicon-pencil\"></span></button> "
            +"<button type=\"button\" class=\"btn btn-xs btn-default command-delete\" data-row-id=\'" + row.id + "\'>删除<span class=\"glyphicon glyphicon-trash\"></span></button> "; 
        }
    	}
    }).on("loaded.rs.jquery.bootgrid", function()
	{
    /* Executes after data is loaded and rendered */
	    grid.find(".command-edit").on("click", function(e)
	    {
	        $(".actormodal").modal();
	        $.get("/sougoulog/"+$(this).data("row-id"),function(str){
	        	$("#rank").val(str.data[0].rank);
	        	$("#clicknum").val(str.data[0].clicknum);
	        	$("#userid").val(str.data[0].userid);
	        	$("#visittime").val(str.data[0].visittime);
	        	$("#url").val(str.data[0].url);
	        	$("#keywords").val(str.data[0].keywords);
	        	$("#id").val(str.data[0].id);
	        });
	        
	    }).end().find(".command-delete").on("click", function(e)
		    {
		        $.ajax({  
			        url : "/indexDocs/sougoulog/_doc/"+$(this).data("row-id"),  
			        type : "DELETE",  
			        success : function(result) { 
			        	alert("删除成功");
		        		$("#grid-data").bootgrid("reload");
		        		}
		    	});
		    	});
		    	});
  
   			$("#grid-data2").bootgrid({
			    ajax:true,
			    url:"/sougoulog?startdate=00:00:00&enddate=00:05:00",
			    navigation:3,
			    ajaxSettings: {
			        method: "POST",
			        cache: false
			    },	
        	formatters: {
        	"keywords": function(column, row){
	        	var search = "highlight";
		        var highlightObj = row[search];
		        var currentKey = column.id;
		        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
		            return highlightObj[currentKey];
		        } else {
		            return row[currentKey];
		        }
	        },
	        "url": function(column, row){
	        	var search = "highlight";
		        var highlightObj = row[search];
		        var currentKey = column.id;
		        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
		            return highlightObj[currentKey];
		        } else {
		            return row[currentKey];
		        }
	        },
	        "userid": function(column, row){
	        	var search = "highlight";
		        var highlightObj = row[search];
		        var currentKey = column.id;
		        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
		            return highlightObj[currentKey];
		        } else {
		            return row[currentKey];
		        }
	        }
    	}	
    }).on("loaded.rs.jquery.bootgrid", function()
	{
    /* Executes after data is loaded and rendered */
	    grid.find(".command-edit2").on("click", function(e)
	    {
	        $(".actormodal").modal();
	        $.get("/actors/"+$(this).data("row-id"),function(str){
	        	$("#fname").val(str.first_name);
	        	$("#lname").val(str.last_name);
	        	$("#lupdate").val(str.last_update);
	        	$("#actorid").val(str.id);
	        });
	    }).end().find(".command-delete2").on("click", function(e)
		    {
		        $.ajax({  
			        url : "/actors/"+$(this).data("row-id"),  
			        type : "DELETE",  
			        success : function(result) { 
			        	alert("删除成功");
		        		$("#grid-data").bootgrid("reload");
		        		}
		    	});
		    	});
		});
  
  $("#grid-data3").bootgrid({
			    ajax:true,
			    url:"/sougoulog?startdate=00:05:00&enddate=00:10:00",
			    navigation:3,
			    ajaxSettings: {
			        method: "POST",
			        cache: false
			    },	
        	formatters: {
        	"keywords": function(column, row){
	        	var search = "highlight";
		        var highlightObj = row[search];
		        var currentKey = column.id;
		        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
		            return highlightObj[currentKey];
		        } else {
		            return row[currentKey];
		        }
	        },
	        "url": function(column, row){
	        	var search = "highlight";
		        var highlightObj = row[search];
		        var currentKey = column.id;
		        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
		            return highlightObj[currentKey];
		        } else {
		            return row[currentKey];
		        }
	        },
	        "userid": function(column, row){
	        	var search = "highlight";
		        var highlightObj = row[search];
		        var currentKey = column.id;
		        if ( Object.keys(highlightObj).indexOf(currentKey) >= 0 ) {
		            return highlightObj[currentKey];
		        } else {
		            return row[currentKey];
		        }
	        }
    	}	
    }).on("loaded.rs.jquery.bootgrid", function()
	{
    /* Executes after data is loaded and rendered */
	    grid.find(".command-edit").on("click", function(e)
	    {
	        $(".actormodal").modal();
	        $.get("/actors/"+$(this).data("row-id"),function(str){
	        	$("#fname").val(str.first_name);
	        	$("#lname").val(str.last_name);
	        	$("#lupdate").val(str.last_update);
	        	$("#actorid").val(str.id);
	        });
	    }).end().find(".command-delete").on("click", function(e)
		    {
		        $.ajax({  
			        url : "/actors/"+$(this).data("row-id"),  
			        type : "DELETE",  
			        success : function(result) { 
			        	alert("删除成功");
		        		$("#grid-data").bootgrid("reload");
		        		}
		    	});
		    	});
		});
  
   		
  		$("#add").click(function(){
  	 		$(".addmodal").modal();
  	 	});
  	 	
  	 	
  	 	
  });
 
function jsonShowFn(json){
                if (!json.match("^\{(.+:.+,*){1,}\}$")) {
                    return json           //判断是否是json数据，不是直接返回
                }

                if (typeof json != 'string') {
                    json = JSON.stringify(json, undefined, 2);
                }
                json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
                return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function(match) {
                    var cls = 'number';
                    if (/^"/.test(match)) {
                        if (/:$/.test(match)) {
                            cls = 'key';
                        } else {
                            cls = 'string';
                        }
                    } else if (/true|false/.test(match)) {
                        cls = 'boolean';
                    } else if (/null/.test(match)) {
                        cls = 'null';
                    }
                    return '<span class="' + cls + '">' + match + '</span>';
                });
}
$(document).ready(function(){
	var json ={
		  "settings": {
		    "analysis": {
		      "filter": {
		        "my_filter": {
		          "type": "stop",
		          "stopwords": ""
		        }
		      },
		      "tokenizer": {
		        "my_tokenizer": {
		          "type": "standard",
		          "max_token_length": "1"
		        }
		      },
		      "analyzer": {
		        "my_analyzer": {
		          "filter": "my_filter",
		          "char_filter": "",
		          "type": "custom",
		          "tokenizer": "my_tokenizer"
		        }
		      }
		    }
		  },
		  "mappings": {
		    "_doc": {
		      "properties": {
		      	  "id": {
		            "type": "integer"
		          },
		          "clicknum": {
		            "type": "integer"
		          },
		          "keywords": {
		            "type": "text",
		            "analyzer": "my_analyzer"
		          },
		          "rank": {
		            "type": "integer"
		          },
		          "url": {
		            "type": "text",
		            "analyzer": "my_analyzer"
		          },
		          "userid": {
		            "type": "text",
		            "analyzer": "my_analyzer"
		          },
		          "visittime": {
		            "type": "date",
		            "format": "HH:mm:ss"
		          }
		        
		      }
		    }
		  }
		};
		
	$('#jsonShow').html(jsonShowFn(JSON.stringify(json)));
	
	$("#mapping").click(function(){
		$.get("createIndexMapping",function(){
			alert("sougoulog索引创建成功");
		});
	});
	
	$("#import").click(function(){
		$.get("indexDocs",function(){
			alert("sougoulog数据导入成功");
		});
	});
	
	$("#distancemapping").click(function(){
		$.get("createShopMapping",function(){
			alert("经纬度索引构建成功");
		});
	});
	
	$("#importdistance").click(function(){
		$.get("importShops",function(){
			alert("经纬度数据导入成功");
		});
	});
	
	$("#nestedmapping").click(function(){
		$.get("createCityMapping",function(){
			alert("嵌套对象索引构建成功");
		});
	});
	
	$("#nestedimport").click(function(){
		$.get("importCitys",function(){
			alert("嵌套对象数据导入成功");
		});
	});	
	
	$("#joinmapping").click(function(){
		$.get("createJoinMapping",function(){
			alert("嵌套对象索引构建成功");
		});
	});
	
	$("#joinimport").click(function(){
		$.get("importJoinCitys",function(){
			alert("嵌套对象数据导入成功");
		});
	});		
	
});
  </script>
</body>
</html>
